/**************************************************************************
 *  创建者：        hualei
 *  开始时间：   2018.09.28
 *  copyright:  (C) 深圳市华友高科有限公司
 *  修改说明：  (每次有修改就添加一条，带有 修改人，修改时间，修改描述)
 *
 ***************************************************************************
 *   CHARGING 充电指令逻辑处理类的具体实现
 *
 ***************************************************************************/
#include "charginginstructiondelegate.h"

ChargingInstructionDelegate::ChargingInstructionDelegate(QWidget *parent)
    : QWidget(parent)
{
}

void ChargingInstructionDelegate::initView()
{
    chargingInstructionView->chargingCaparity = 0;
    chargingInstructionView->chargingTime = 0;
    chargingInstructionView->chargingFinishedType = E_CHARGING_TIME;
    chargingInstructionView->noteStr = "";

}

void ChargingInstructionDelegate::finishEditInstructionSlot()
{
    chargingInstructionView->instructionStr = QObject::tr("CHARGING ");

    if(chargingInstructionView->chargingFinishedType == E_CHARGING_CAPARITY)
    {
        chargingInstructionView->instructionStr += QObject::tr("CAPARITY,") + QString::number(chargingInstructionView->chargingCaparity);
<<<<<<< HEAD


=======
>>>>>>> dev
    }
    else if(chargingInstructionView->chargingFinishedType == E_CHARGING_TIME)
    {
        chargingInstructionView->instructionStr += QObject::tr("TIME,") + QString::number(chargingInstructionView->chargingTime);

    }
    else if(chargingInstructionView->chargingFinishedType == E_CHARGING_FIRST_FINISHED)
    {
        chargingInstructionView->instructionStr += QObject::tr("FIRFIN,") + QString::number(chargingInstructionView->chargingTime) + "," +\
                QString::number(chargingInstructionView->chargingCaparity);

    }

    chargingInstructionView->instructionStr += QObject::tr("    //") + chargingInstructionView->noteStr;

}

void ChargingInstructionDelegate::cleanNoteSlot()
{
    chargingInstructionView->noteStr.clear();
}

